<?php

// $Id$

require_once($WSC->get_site_inc_dir().'_sys/site_web_page.class.php');

class Not_Found_WP extends Site_Web_Page {
	public function init() {
		parent::init();

		$v = $this->create_view();
		$this->add_view($v);
	}


	public function run() {
		$context = $this->get__context();
		$uri = $context->get_from_server('REQUEST_URI');
		$this->export('uri', urldecode($uri));
		$ret = $this->get_view('default');

		$this->log_not_found($uri);

		return $ret;
	}


	private function log_not_found($uri) {
		$config = $this->get__config();

		$log_dir = $config->get_logs_dir();
		$not_found_log = $log_dir.'not_found.log';
		error_log(date('Y-m-d H:i:s')." $uri\r\n", 3, $not_found_log);
		@chmod($not_found_log, 0660);
	}
}


